package com.yantong.controller.api;

import com.yantong.annotation.Auth;
import com.yantong.annotation.LoginUser;
import com.yantong.controller.BaseController;
import com.yantong.pojo.Member;
import com.yantong.pojo.TicketParam;
import com.yantong.result.ResultVo;
import com.yantong.service.TicketService;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import springfox.documentation.annotations.ApiIgnore;

/**
 * 营销活动管理
 *
 * @author kanghaixin
 * @date 2018/9/7.15:39
 */
@ApiIgnore
@Controller
@RequestMapping("/wxapi/ticket")
public class ApiTicketController extends BaseController {
    private static final Logger LOGGER = LoggerFactory.getLogger(ApiTicketController.class);

    @Autowired
    private TicketService ticketService;

    /**
     * 优惠券核销
     *
     * @param ticketParam
     * @return
     */
    @ApiOperation(value = "优惠券核销")
    @PostMapping("/writeOff")
    @ResponseBody
    @Auth
    public ResultVo writeOff(@LoginUser Member member, @RequestBody TicketParam ticketParam) {
        ResultVo resultVo = ResultVo.ok();
        return resultVo.put("data",ticketService.writeOffTicket(member,ticketParam));
    }
}
